package com.gupaoedu.vip.jdbc.demo;

import com.gupaoedu.vip.jdbc.demo.entity.Member;
import com.gupaoedu.vip.jdbc.framework.EntityOperation;
import com.gupaoedu.vip.jdbc.framework.QueryRule;
import com.gupaoedu.vip.jdbc.framework.QueryRuleSqlBuilder;

public class SQLTest {
	public static void main(String[] args) {
		QueryRule queryRule = QueryRule.getInstance();
		queryRule.andEqual("name", "wzy");
		queryRule.andBetween("age", 18, 60);
		queryRule.andLike("addr", "%北京昌平区%");
		queryRule.orIn("tel", "15878956236", "18601012589");

		QueryRuleSqlBuilder builder = new QueryRuleSqlBuilder(queryRule);

		String whereSQL = builder.getWhereSql();
		String orderBySQL = builder.getOrderSql();
		Object[] values = builder.getValues();

		System.out.println(whereSQL);
		System.out.println(orderBySQL);
		System.out.println(values);
		
		try {
			EntityOperation<Member> entityOperation = new EntityOperation<>(Member.class, "id");
		
			System.out.println(entityOperation);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
